package com.hawk.eye.server.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hawk.eye.api.storage.dto.LogMessageDTO;
import com.hawk.eye.server.constant.CreateProblemStatusEnum;
import com.hawk.eye.server.domain.dto.resp.TemplateRespDTO;
import com.hawk.eye.server.domain.po.AlarmBaseLog;
import com.hawk.eye.server.domain.po.ServiceConfig;

import java.time.LocalDateTime;
import java.util.Map;


/**
 * 告警日志 Service接口
 *
 * @author salad
 * @date 2023-10-23
 */
public interface IAlarmBaseLogService extends IService<AlarmBaseLog> {

    /**
     * @param serviceConfig
     * @param alarmLogAsMap
     * @return
     */
    LogMessageDTO resolveLogMessage(ServiceConfig serviceConfig, Map<String, Object> alarmLogAsMap);

    /**
     * @param alarmLogAsMap
     * @param serviceConfig
     * @param logMessageDTO
     * @return
     */
    String getUpgradesAlarm(Map<String, Object> alarmLogAsMap, ServiceConfig serviceConfig, LogMessageDTO logMessageDTO);

    /**
     * @param stackHash
     * @return
     */
    long getCountByStackHash(String stackHash);

    /**
     * @param logMessageDTO
     * @param start
     * @param end
     * @return
     */
    long getCountByPeriod(LogMessageDTO logMessageDTO, LocalDateTime start, LocalDateTime end);

    /**
     * @param serviceConfig
     * @param logMessageDTO
     * @return
     */
    boolean silenceAlarm(ServiceConfig serviceConfig, LogMessageDTO logMessageDTO);

    /**
     * @param dataDTO
     * @param template
     * @param alarmLogAsMap
     */
    void saveLogMessage(LogMessageDTO dataDTO, TemplateRespDTO template, Map<String, Object> alarmLogAsMap);

    /**
     * @param baseAlarmId
     * @param createProblemStatusEnum
     * @return
     */
    Boolean updateProblemStatus(Long baseAlarmId, CreateProblemStatusEnum createProblemStatusEnum);

}
